from django import forms
from django.forms import ModelForm
from django.forms import widgets  # 小组件
from django.forms import fields

from .models import Info as I


# 姓名，年龄，爱好，邮箱，电话，住址，注册时间
# class Info(forms.Form):
#     name = forms.CharField(max_length=20, min_length=2)
#     age = forms.IntegerField(max_value=200)
#     email = forms.EmailField()
#     # hoby = fields.ChoiceField(choices=[('1', "吃饭"), ('2', "睡觉")])
#     # hoby = forms.CharField(widget=forms.Textarea)
#     hoby = forms.CharField(widget=widgets.RadioSelect(choices=[('1', "吃饭"), ('2', "睡觉")]))


class Info(forms.ModelForm):
    class Meta:
        model = I  # student 模型
        # fields = '__all__'
        fields = ['name', 'age', 'email']
